<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>

<head>
    <title>签约统计</title>
    <style>
        .table-responsive .table-bordered > thead > tr > th{background:#f1f1f1;}
        table.dataTable thead .sorting_disabled{background:#f1f1f1; }
    </style>
</head>

<body>

<div id="jy wrapper">
    <div class="gray-bg">
        <div class="jy-nav-box">
            <ul class="navbar-nav">
                <%--<li><span>${teamName}</span><a class="switch">切换团队</a></li>--%>
                <li><a href="/medical/base/statistic/listStreet" class="active">工作量统计</a></li>
                <li><a href="/medical/base/statistic/listServantStreet">签约服务统计</a></li>
                <li><a href="/medical/base/statistic/listBase">基数维护</a></li>
            </ul>
            <div class="dropdown-menu">
                <ul id="teamSwitch">
                </ul>
            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox">
                        <div class="ibox-content">
                            <div class="search-area">
                                <form role="form" class="form-inline" id="queryform">
                                    <input type="hidden" id="signTab" name="signTab" value="1" class="form-control form-filter">
                                    <input type="hidden" id="streetId" name="streetId" value="${streetId}" class="form-control form-filter">
                                    <input type="hidden" id="teamId" name="teamId" value="${teamId}" class="form-control form-filter">
                                    <div class="col-sm-1">
                                        <a href="/medical/base/statistic/listTeam?streetId=${streetId}">
                                            返回上一级
                                        </a>
                                    </div>
                                    <div class="form-group">
                                        <div class="input-group date" datepicker>
                                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                            <input type="text" id="beginTime" name="beginTime" placeholder="开始日期" class="form-control form-filter" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="input-group date" datepicker>
                                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                            <input type="text" id="endTime" name="endTime" placeholder="结束日期" class="form-control form-filter" >
                                        </div>
                                    </div>
                                    <%--<input type="hidden" id="teamId" value="${teamId}" name="teamId" class="form-control form-filter"  />--%>
                                    <label for="status">
                                        <select id="status" name="signStatus"  class="form-control form-filter" form="queryform" style="width:100%">
                                            <option value="0" selected="true">签约方式</option>
                                            <option value="1">居民签约</option>
                                            <option value="2">医生代签</option>
                                        </select></label>
                                    <%--<label for="regionId">
                                        <select id="regionId" name="regionId"  class="form-control form-filter" form="queryform" style="width:100%">
                                            <option value="404345" selected = "selected">南京市浦口区</option>
                                            <option value="767480">南京市江北新区</option>
                                        </select></label>--%>


                                    <button class="btn" type="button" onclick="submitFilter()"> 查询</button>
                                    <button class="btn" datatable-clear type="button"> 清除</button>
                                    <button class="btn" id="btnExport" type="button"> 导出</button>
                                </form>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover dataTables" id="data-table"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>

<script src="${ctx}/static/inspinia/js/plugins/layer/layer.js"></script>
<!-- Page-Level Scripts -->
<script>
    (function($){
        $.fn.datepicker.dates['zh-CN'] = {
            days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
            daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
            daysMin:  ["日", "一", "二", "三", "四", "五", "六", "日"],
            months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
            monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
            today: "今天",
            suffix: [],
            meridiem: ["上午", "下午"]
        };
    }(jQuery));
</script>
<script>
    $(document).ready(function () {

        $('#beginTime').datepicker({format: 'yyyy-mm-dd',language: 'zh-CN'});
        $('#endTime').datepicker({format: 'yyyy-mm-dd',language: 'zh-CN'});


        var setting = {
            "ajax": {
                "url": "${ctx}/medical/base/statistic/listMember",
                "type": "POST"
            },
            "columns": [
                {"title": "成员姓名", "data": "memberName", "width": "5%", "orderable": false},
                //{"title": "已组建家医团队数", "data": "teamNum", "width": "6.6%", "orderable": false},
                {"title": "非重点人群", "data": "noKeyGroup", "width": "5%", "orderable": false},
                {"title": "辖区重点人群", "data": "keyGroup", "width": "5%", "orderable": false},
                {"title": "0-6岁儿童", "data": "childrenGroup", "width": "5%", "orderable": false},
                {"title": "孕产妇", "data": "pregnantGroup", "width": "5%", "orderable": false},
                {"title": "65岁以上老年人", "data": "agedGroup", "width": "5%", "orderable": false},
                {"title": "高血压患者", "data": "hypertensionGroup", "width": "5%", "orderable": false},
                {"title": "2型糖尿病患者", "data": "diabeticGroup", "width": "5%", "orderable": false},
                {"title": "重性精神疾病患者", "data": "psychoticGroup", "width": "5%", "orderable": false},
                {"title": "肺结核患者", "data": "tuberculosisGroup", "width": "5%", "orderable": false},
                {"title": "农村建档立卡低收入人口", "data": "recordCardGroup", "width": "5%", "orderable": false},
                {"title": "城镇低保人群", "data": "allowancesGroup", "width": "5%", "orderable": false},
                {"title": "计划生育特殊家庭", "data": "familyPlanSpecialGroup", "width": "5%", "orderable": false},
                {"title": "残疾人", "data": "disabledGroup", "width": "5%", "orderable": false},
            ],
            "columnDefs": [
                {
                    "targets": 1,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 2,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 3,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 4,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 5,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 6,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 7,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 8,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 9,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 10,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 11,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 12,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                },
                {
                    "targets": 13,
                    "render": function (data, type, row, meta) {
                        if(data == 0||data == undefined){
                            return "0";
                        }else{
                            return data;
                        }
                    },
                    "orderable": false
                }

            ],
            "order": [
                [0, "desc"]
            ]
        };
        /* Init DataTables */
        $('#data-table').DataTable(ehconfig.get_datatable_config(setting));
        submitFilter = function () {
            $('#data-table').DataTable().draw();
        }
        $('#btnExport').click(function () {

            var signTab = $('#signTab').val();
            var beginTime = $('#beginTime').val();
            var endTime = $('#endTime').val();
            var regionId = $('#regionId').val();
            var signType = $('#signType').val();
            var headers = "";
            for(var i=0; i < setting.columns.length; i++){
                headers += (setting.columns[i].title)+",";
            }
            headers = headers.substring(0, headers.length-1);
            layer.load(1);
            $.ajax({
                method: "POST",
                url: "${ctx}/medical/base/statistic/downExcel",
                data: {
                    "signTab":signTab,
                    "beginTime":beginTime,
                    "endTime":endTime,
                    "regionId":regionId,
                    "signType":signType,
                    "headers":headers
                },
                dataType: "json",
                success: function(response) {
                    if (response.code == 0) {
                        console.log(response.path)
                        location.href=response.path;
                    }else{
                        layer.msg(response.msg);
                    }
                    layer.closeAll();
                }
            });
        });
    });

    
   /* function excel() {
        var signTab = $('#signTab').val();
        var beginTime = $('#beginTime').val();
        var endTime = $('#endTime').val();
        var regionId = $('#regionId').val();
        var signType = $('#signType').val();
        var headers = "";
        for(var i=0; i < setting.columns.length; i++){
            headers += (setting.columns[i].name)+",";
        }
        headers = headers.substring(0, headers.length-1);
        $.ajax({
            method: "POST",
            url: "${ctx}/medical/base/statistic/downExcel",
            data: {
                "signTab":signTab,
                "beginTime":beginTime,
                "endTime":endTime,
                "regionId":regionId,
                "signType":signType,
                "headers":headers
            },
            dataType: "json",
            async: false,
            success: function(response) {
                if (response.code == 0) {
                    console.log(response.path)
                    location.href=response.path;
                }else{
                    layer.msg(response.msg);
                }
            }
        });
    }
*/
    /*function refest() {
        $('#data-table').DataTable().draw();
    }*/

</script>

</body>

</html>
